home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / SPAWNO41.ARJ / SPAWNLPE.C < prev    next >
C/C++ Source or Header  |  1991-11-10  |  1KB  |  38 lines

  1. /********************************************************************/
  2. /*   SPAWNO v4.0   EMS/XMS/disk swapping replacement for spawn...() */
  3. /*   (c) Copyright 1990, 1991 Ralf Brown  All Rights Reserved        */
  4. /*                                    */
  5. /*   May be freely copied provided that this copyright notice is    */
  6. /*   not altered or removed.                        */
  7. /********************************************************************/
  8.  
  9. #include "_spawno.h"
  10. #include <alloc.h>
  11.  
  12. int _Cdecl spawnlpeo(const char *overlay_path,const char *prog_name,...)
  13. {
  14.    char *prog_path = __spawn_search(prog_name) ;
  15.  
  16.    if (prog_path)
  17.       {
  18.       int retval ;
  19.       va_list env ;
  20.  
  21.       va_start(env,1) ;
  22.       while (*((char **)env))  /* find NULL terminating list of program args */
  23.      va_arg(env,char *) ;
  24.       va_arg(env,const char **) ; /* point at pointer to list of env variables */
  25.       retval = __spawnv(overlay_path,prog_path,(const char **)_va_ptr,
  26.             __spawn_buildenv(*((char ***)env))) ;
  27.       va_end(env) ;
  28.       __spawn_free_env() ;
  29.       return retval ;
  30.       }
  31.    else
  32.       {
  33.       errno = ENOENT ;    /* not found-- _doserrno was set by __spawn_search() */
  34.       return -1 ;
  35.       }
  36. }
  37.  
  38.